package com.hougong.im.aspect;

import com.baomidou.mybatisplus.toolkit.SystemClock;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class SysLogAspect {
    @Pointcut("@annotation(com.hougong.im.annotation.SysLog)")
    public void logPointCut() {

    }
    @Around("logPointCut()")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        long beginTime = SystemClock.now();
        //执行方法
        Object result = point.proceed();
        //执行时长(毫秒)
        long time = SystemClock.now() - beginTime;

        //保存日志

        return result;
    }
}
